﻿using System;
using UnityEngine;

namespace Studio
{
	// Token: 0x02000495 RID: 1173
	public class OCIFolder : ObjectCtrlInfo
	{
		// Token: 0x17000306 RID: 774
		// (get) Token: 0x06001D2D RID: 7469 RVA: 0x000BA114 File Offset: 0x000B8314
		public OIFolderInfo folderInfo
		{
			get
			{
				return this.objectInfo as OIFolderInfo;
			}
		}

		// Token: 0x17000307 RID: 775
		// (get) Token: 0x06001D2E RID: 7470 RVA: 0x000BA124 File Offset: 0x000B8324
		// (set) Token: 0x06001D2F RID: 7471 RVA: 0x000BA134 File Offset: 0x000B8334
		public string name
		{
			get
			{
				return this.folderInfo.name;
			}
			set
			{
				this.folderInfo.name = value;
				this.treeNodeObject.textName = value;
			}
		}

		// Token: 0x06001D30 RID: 7472 RVA: 0x000BA150 File Offset: 0x000B8350
		public override void OnDelete()
		{
			Singleton<GuideObjectManager>.Instance.Delete(this.guideObject, true);
			UnityEngine.Object.Destroy(this.objectItem);
			if (this.parentInfo != null)
			{
				this.parentInfo.OnDetachChild(this);
			}
			Studio.DeleteInfo(this.objectInfo, true);
		}

		// Token: 0x06001D31 RID: 7473 RVA: 0x000BA19C File Offset: 0x000B839C
		public override void OnAttach(TreeNodeObject _parent, ObjectCtrlInfo _child)
		{
			if (_child.parentInfo == null)
			{
				Studio.DeleteInfo(_child.objectInfo, false);
			}
			else
			{
				_child.parentInfo.OnDetachChild(_child);
			}
			if (!this.folderInfo.child.Contains(_child.objectInfo))
			{
				this.folderInfo.child.Add(_child.objectInfo);
			}
			_child.guideObject.transformTarget.SetParent(this.childRoot);
			_child.guideObject.parent = this.childRoot;
			_child.objectInfo.changeAmount.pos = _child.guideObject.transformTarget.localPosition;
			_child.objectInfo.changeAmount.rot = _child.guideObject.transformTarget.localEulerAngles;
			_child.parentInfo = this;
		}

		// Token: 0x06001D32 RID: 7474 RVA: 0x000BA270 File Offset: 0x000B8470
		public override void OnLoadAttach(TreeNodeObject _parent, ObjectCtrlInfo _child)
		{
			if (_child.parentInfo == null)
			{
				Studio.DeleteInfo(_child.objectInfo, false);
			}
			else
			{
				_child.parentInfo.OnDetachChild(_child);
			}
			if (!this.folderInfo.child.Contains(_child.objectInfo))
			{
				this.folderInfo.child.Add(_child.objectInfo);
			}
			_child.guideObject.transformTarget.SetParent(this.childRoot, false);
			_child.guideObject.parent = this.childRoot;
			_child.objectInfo.changeAmount.OnChange();
			_child.parentInfo = this;
		}

		// Token: 0x06001D33 RID: 7475 RVA: 0x000BA318 File Offset: 0x000B8518
		public override void OnDetach()
		{
			this.parentInfo.OnDetachChild(this);
			this.guideObject.parent = null;
			Studio.AddInfo(this.objectInfo, this);
			this.objectItem.transform.SetParent(Singleton<Scene>.Instance.commonSpace.transform);
			this.objectInfo.changeAmount.pos = this.objectItem.transform.localPosition;
			this.objectInfo.changeAmount.rot = this.objectItem.transform.localEulerAngles;
			this.guideObject.calcMode = GuideObject.Mode.Local;
		}

		// Token: 0x06001D34 RID: 7476 RVA: 0x000BA3B4 File Offset: 0x000B85B4
		public override void OnSelect(bool _select)
		{
		}

		// Token: 0x06001D35 RID: 7477 RVA: 0x000BA3B8 File Offset: 0x000B85B8
		public override void OnDetachChild(ObjectCtrlInfo _child)
		{
			if (!this.folderInfo.child.Remove(_child.objectInfo))
			{
				GlobalData.Debug_LogError("信息删除失败");
			}
			_child.parentInfo = null;
		}

		// Token: 0x06001D36 RID: 7478 RVA: 0x000BA3E8 File Offset: 0x000B85E8
		public override void OnSavePreprocessing()
		{
			base.OnSavePreprocessing();
		}

		// Token: 0x06001D37 RID: 7479 RVA: 0x000BA3F0 File Offset: 0x000B85F0
		public override void OnVisible(bool _visible)
		{
		}

		// Token: 0x04001FB0 RID: 8112
		public GameObject objectItem;

		// Token: 0x04001FB1 RID: 8113
		public Transform childRoot;
	}
}
